class Character {
  Character({
    required this.id,
    required this.cv,
    required this.name,
    required this.nameEnglish,
    required this.ascmat,
    required this.belong,
    required this.birthday,
    required this.bossmat,
    required this.commonmat,
    required this.commonmatt,
    required this.constellation,
    required this.curve,
    required this.custompromote,
    required this.desc,
    required this.element,
    required this.fetter,
    required this.grade,
    required this.icon,
    this.na,
    required this.nation,
    required this.note,
    this.nr,
    this.nw,
    required this.pics,
    required this.poise,
    required this.showstats,
    required this.showstats2,
    required this.specialitymat,
    required this.talentmat,
    required this.talentmatt,
    required this.title,
    required this.type,
    required this.version,
    this.vs,
    required this.weapon,
    required this.weeklymat,
    required this.weekmat,
  });

  late final int id;
  late final CV cv;
  late final String name;
  late final String nameEnglish;
  late final int ascmat;
  late final String belong;
  late final String birthday;
  late final int bossmat;
  late final int commonmat;
  late final int commonmatt;
  late final String constellation;
  late final int curve;
  late final String custompromote;
  late final String desc;
  late final String element;
  late final int fetter;
  late final int grade;
  late final String icon;
  late final Null na;
  late final String nation;
  late final String note;
  late final Null nr;
  late final Null nw;
  late final List<String> pics;
  late final String poise;
  late final Showstats showstats;
  late final Showstats? showstats2;
  late final int specialitymat;
  late final int talentmat;
  late final int talentmatt;
  late final String title;
  late final String type;
  late final String version;
  late final Null vs;
  late final String weapon;
  late final int weeklymat;
  late final int weekmat;

  Character.fromJson(Map<String, dynamic> json) {
    id = json['id'];
    cv = CV.fromJson(json['_CV']);
    name = json['name'];
    nameEnglish = json['_name'];
    ascmat = json['ascmat'];
    belong = json['belong'];
    birthday = json['birthday'];
    bossmat = json['bossmat'];
    commonmat = json['commonmat'];
    commonmatt = json['commonmatt'];
    constellation = json['constellation'];
    curve = json['curve'];
    custompromote = json['custompromote'];
    desc = json['desc'];
    element = json['element'];
    fetter = json['fetter'];
    grade = json['grade'];
    icon = json['icon'];
    na = null;
    nation = json['nation'];
    note = json['note'];
    nr = null;
    nw = null;
    pics = List.castFrom<dynamic, String>(json['pics']);
    poise = json['poise'];
    showstats = Showstats.fromJson(json['showstats']);
    if (json['showstats2'] != null) {
      showstats2 = Showstats.fromJson(json['showstats2']);
    }
    specialitymat = json['specialitymat'];
    talentmat = json['talentmat'];
    talentmatt = json['talentmatt'];
    title = json['title'];
    type = json['type'];
    version = json['version'];
    vs = null;
    weapon = json['weapon'];
    weeklymat = json['weeklymat'];
    weekmat = json['weekmat'];
    print(icon);
  }

  Map<String, dynamic> toJson() {
    final data = <String, dynamic>{};
    data['id'] = id;
    data['_CV'] = cv.toJson();
    data['name'] = name;
    data['_name'] = nameEnglish;
    data['ascmat'] = ascmat;
    data['belong'] = belong;
    data['birthday'] = birthday;
    data['bossmat'] = bossmat;
    data['commonmat'] = commonmat;
    data['commonmatt'] = commonmatt;
    data['constellation'] = constellation;
    data['curve'] = curve;
    data['custompromote'] = custompromote;
    data['desc'] = desc;
    data['element'] = element;
    data['fetter'] = fetter;
    data['grade'] = grade;
    data['icon'] = icon;
    data['na'] = na;
    data['name'] = name;
    data['nation'] = nation;
    data['note'] = note;
    data['nr'] = nr;
    data['nw'] = nw;
    data['pics'] = pics;
    data['poise'] = poise;
    data['showstats'] = showstats.toJson();
    data['showstats2'] = showstats2?.toJson();
    data['specialitymat'] = specialitymat;
    data['talentmat'] = talentmat;
    data['talentmatt'] = talentmatt;
    data['title'] = title;
    data['type'] = type;
    data['version'] = version;
    data['vs'] = vs;
    data['weapon'] = weapon;
    data['weeklymat'] = weeklymat;
    data['weekmat'] = weekmat;
    return data;
  }
}

class CV {
  CV({
    required this.CH,
    required this.EN,
    required this.JP,
    required this.KR,
  });

  late final String CH;
  late final String EN;
  late final String JP;
  late final String KR;

  CV.fromJson(Map<String, dynamic> json) {
    CH = json['_CH'];
    EN = json['_EN'];
    JP = json['_JP'];
    KR = json['_KR'];
  }

  Map<String, dynamic> toJson() {
    final data = <String, dynamic>{};
    data['_CH'] = CH;
    data['_EN'] = EN;
    data['_JP'] = JP;
    data['_KR'] = KR;
    return data;
  }
}

class Showstats {
  Showstats({
    required this.hp,
    required this.atk,
    required this.def,
    required this.custom,
  });

  late final int hp;
  late final int atk;
  late final int def;
  late final double custom;

  Showstats.fromJson(Map<String, dynamic> json) {
    hp = json['hp'];
    atk = json['atk'];
    def = json['def'];
    custom = json['custom'];
  }

  Map<String, dynamic> toJson() {
    final data = <String, dynamic>{};
    data['hp'] = hp;
    data['atk'] = atk;
    data['def'] = def;
    data['custom'] = custom;
    return data;
  }
}

class Item {
  Item({
    required this.id,
    required this.desc,
    required this.icon,
    required this.name,
    required this.r,
    required this.src,
    required this.type,
  });

  late final int id;
  late final String desc;
  late final String icon;
  late final String name;
  late final int r;
  late final List<String> src;
  late final String type;

  Item.fromJson(Map<String, dynamic> json) {
    id = json['id'];
    desc = json['desc'];
    icon = json['icon'];
    name = json['name'];
    r = json['r'];
    if (json['src'] != null) {
      src = List.castFrom<dynamic, String>(json['src']);
    } else {
      src = [];
    }
    type = json['type'];
  }

  Map<String, dynamic> toJson() {
    final data = <String, dynamic>{};
    data['id'] = id;
    data['desc'] = desc;
    data['icon'] = icon;
    data['name'] = name;
    data['r'] = r;
    data['src'] = src;
    data['type'] = type;
    return data;
  }
}

class Weapon {
  Weapon({
    required this.id,
    required this.ascmatid,
    required this.custom,
    required this.customstat,
    required this.desc,
    required this.equipaffixid,
    required this.equipaffixname,
    required this.extra,
    required this.icons,
    required this.matids,
    required this.monicons,
    required this.monids,
    required this.name,
    required this.rank,
    required this.stat,
    required this.story,
    required this.storycount,
    required this.type,
    required this.v,
  });

  late final int id;
  late final int ascmatid;
  late final String custom;
  late final double customstat;
  late final String desc;
  late final int equipaffixid;
  late final String equipaffixname;
  late final List<dynamic> extra;
  late final List<String> icons;
  late final List<int> matids;
  late final List<String> monicons;
  late final List<int> monids;
  late final String name;
  late final int rank;
  late final double stat;
  late final int story;
  late final int storycount;
  late final int type;
  late final String v;

  Weapon.fromJson(Map<String, dynamic> json) {
    id = json['id'];
    ascmatid = json['ascmatid'];
    custom = json['custom'];
    customstat = json['customstat'];
    desc = json['desc'];
    equipaffixid = json['equipaffixid'];
    equipaffixname = json['equipaffixname'];
    extra = List.castFrom<dynamic, dynamic>(json['extra']);
    icons = List.castFrom<dynamic, String>(json['icons']);
    matids = List.castFrom<dynamic, int>(json['matids']);
    monicons = List.castFrom<dynamic, String>(json['monicons']);
    monids = List.castFrom<dynamic, int>(json['monids']);
    name = json['name'];
    rank = json['rank'];
    stat = json['stat'];
    story = json['story'];
    storycount = json['storycount'];
    type = json['type'];
    v = json['v'];
  }

  Map<String, dynamic> toJson() {
    final data = <String, dynamic>{};
    data['id'] = id;
    data['ascmatid'] = ascmatid;
    data['custom'] = custom;
    data['customstat'] = customstat;
    data['desc'] = desc;
    data['equipaffixid'] = equipaffixid;
    data['equipaffixname'] = equipaffixname;
    data['extra'] = extra;
    data['icons'] = icons;
    data['matids'] = matids;
    data['monicons'] = monicons;
    data['monids'] = monids;
    data['name'] = name;
    data['rank'] = rank;
    data['stat'] = stat;
    data['story'] = story;
    data['storycount'] = storycount;
    data['type'] = type;
    data['v'] = v;
    return data;
  }
}

class WeaponAffix {
  WeaponAffix({
    required this.id,
    required this.ver,
  });

  late final int id;
  late final Map<String, List<String>> ver;

  WeaponAffix.fromJson(Map<String, dynamic> json) {
    id = json['id'];
    ver = {};
    Map<String, dynamic> temp = json['ver'];
    temp.forEach((key, value) {
      ver[key] = List.castFrom<dynamic, String>(value);
    });
  }

  Map<String, dynamic> toJson() {
    final data = <String, dynamic>{};
    data['id'] = id;
    data['ver'] = ver;
    return data;
  }
}

class WeaponStory {
  WeaponStory({
    required this.id,
    required this.story,
  });

  late final int id;
  late final List<String> story;

  WeaponStory.fromJson(Map<String, dynamic> json) {
    id = json['id'];
    story = List.castFrom<dynamic, String>(json['story']);
  }

  Map<String, dynamic> toJson() {
    final data = <String, dynamic>{};
    data['id'] = id;
    data['story'] = story;
    return data;
  }
}

class BattleSkill {
  BattleSkill({
    required this.name,
    required this.desc,
    required this.num,
    required this.lock,
    required this.icon,
    required this.paramDesc,
  });

  late final String name;
  late final String desc;
  late final int num;
  late final double lock;
  late final String icon;
  late final List<BattleSkillParamDesc> paramDesc;

  BattleSkill.fromJson(Map<String, dynamic> json) {
    name = json['name'];
    desc = json['desc'];
    num = json['num'];
    lock = json['lock'];
    icon = json['icon'];
    paramDesc = [];
    var tmp = json['paramdesc'];
    if (tmp != null) {
      for (var item in tmp) {
        paramDesc.add(BattleSkillParamDesc.fromJson(item));
      }
    }
  }

  Map<String, dynamic> toJson() {
    final data = <String, dynamic>{};
    data['name'] = name;
    data['desc'] = desc;
    data['num'] = num;
    data['lock'] = lock;
    data['icon'] = icon;
    data['paramdesc'] = paramDesc.map((v) => v.toJson()).toList();
    return data;
  }
}

class BattleSkillParamDesc {
  BattleSkillParamDesc({
    required this.desc,
    required this.paramLevelList,
  });

  late final String desc;
  late final List<String> paramLevelList;

  BattleSkillParamDesc.fromJson(Map<String, dynamic> json) {
    desc = json['desc'];
    paramLevelList = [];
    List tmp = json['paramlevellist'];
    for (var item in tmp) {
      paramLevelList.add(item);
    }
  }

  Map<String, dynamic> toJson() {
    final data = <String, dynamic>{};
    data['desc'] = desc;
    data['paramLevelList'] = paramLevelList;
    return data;
  }
}

class PassiveSkill {
  PassiveSkill({
    required this.name,
    required this.desc,
    required this.icon,
  });

  late final String name;
  late final String desc;
  late final String icon;

  PassiveSkill.fromJson(Map<String, dynamic> json) {
    name = json['name'];
    desc = json['desc'];
    icon = json['icon'];
  }

  Map<String, dynamic> toJson() {
    final data = <String, dynamic>{};
    data['name'] = name;
    data['desc'] = desc;
    data['icon'] = icon;
    return data;
  }
}

class Constellation {
  Constellation({
    required this.level,
    required this.name,
    required this.desc,
    required this.icon,
  });

  late final int level;
  late final String name;
  late final String desc;
  late final String icon;

  Constellation.fromJson(Map<String, dynamic> json) {
    level = json['level'];
    name = json['name'];
    desc = json['desc'];
    icon = json['icon'];
  }

  Map<String, dynamic> toJson() {
    final data = <String, dynamic>{};
    data['level'] = level;
    data['name'] = name;
    data['desc'] = desc;
    data['icon'] = icon;
    return data;
  }
}

class AttackConfig {
  AttackConfig({
    required this.skill,
    required this.shape,
    required this.atkTag,
    required this.attTag,
    required this.attGrp,
    required this.element,
    required this.gU,
    required this.poise,
    required this.forceType,
    required this.force,
    required this.blunt,
    required this.arkhe,
    required this.hTime,
    required this.hScale,
    required this.beHalt,
    required this.canInfuse,
    required this.strikeType,
    required this.attackType,
  });

  late final String skill;
  late final Shape shape;
  late final String atkTag;
  late final String attTag;
  late final String attGrp;
  late final String element;
  late final double gU;
  late final double poise;
  late final int forceType;
  late final List<double> force;
  late final bool blunt;
  late final double arkhe;
  late final double hTime;
  late final double hScale;
  late final bool beHalt;
  late final bool canInfuse;
  late final String strikeType;
  late final String attackType;

  AttackConfig.fromJson(Map<String, dynamic> json) {
    skill = json['skill'];
    shape = Shape.fromJson(json['shape']);
    atkTag = json['atkTag'];
    attTag = json['attTag'];
    attGrp = json['attGrp'];
    element = json['element'];
    gU = json['gU'];
    poise = json['poise'];
    forceType = json['forceType'];
    force = List.castFrom<dynamic, double>(json['force']);
    blunt = json['blunt'];
    arkhe = json['arkhe'];
    hTime = json['hTime'];
    hScale = json['hScale'];
    beHalt = json['beHalt'];
    canInfuse = json['canInfuse'];
    strikeType = json['strikeType'];
    attackType = json['attackType'];
  }

  Map<String, dynamic> toJson() {
    final data = <String, dynamic>{};
    data['skill'] = skill;
    data['shape'] = shape.toJson();
    data['atkTag'] = atkTag;
    data['attTag'] = attTag;
    data['attGrp'] = attGrp;
    data['element'] = element;
    data['gU'] = gU;
    data['poise'] = poise;
    data['forceType'] = forceType;
    data['force'] = force;
    data['blunt'] = blunt;
    data['arkhe'] = arkhe;
    data['hTime'] = hTime;
    data['hScale'] = hScale;
    data['beHalt'] = beHalt;
    data['canInfuse'] = canInfuse;
    data['strikeType'] = strikeType;
    data['attackType'] = attackType;
    return data;
  }
}

class Shape {
  Shape({
    required this.type,
    required this.size,
  });

  late final String type;
  late final List<double> size;

  Shape.fromJson(Map<String, dynamic> json) {
    type = json['type'];
    size = List.castFrom<dynamic, double>(json['size']);
  }

  Map<String, dynamic> toJson() {
    final data = <String, dynamic>{};
    data['type'] = type;
    data['size'] = size;
    return data;
  }
}

class SkillVer {
  SkillVer({
    required this.battleSkills,
    required this.passiveSkills,
    required this.constellations,
  });

  late final List<BattleSkill> battleSkills;
  late final List<PassiveSkill> passiveSkills;
  late final List<Constellation> constellations;

  SkillVer.fromJson(Map<String, dynamic> json) {
    battleSkills = [];
    List? tmp = json['battleskills'];
    if (tmp != null) {
      for (var item in tmp) {
        battleSkills.add(BattleSkill.fromJson(item));
      }
    }
    passiveSkills = [];
    tmp = json['passiveskills'];
    if (tmp != null) {
      for (var item in tmp) {
        passiveSkills.add(PassiveSkill.fromJson(item));
      }
    }
    constellations = [];
    tmp = json['constellations'];
    if (tmp != null) {
      for (var item in tmp) {
        constellations.add(Constellation.fromJson(item));
      }
    }
  }

  Map<String, dynamic> toJson() {
    final data = <String, dynamic>{};
    data['battleskills'] = battleSkills.map((v) => v.toJson()).toList();
    data['passiveskills'] = passiveSkills.map((v) => v.toJson()).toList();
    data['constellations'] = constellations.map((v) => v.toJson()).toList();
    return data;
  }
}

class BallDrop {
  BallDrop({
    required this.when,
    required this.dropArray,
  });

  late final String when;
  late final List<BallDropInfo> dropArray;

  BallDrop.fromJson(Map<String, dynamic> json) {
    when = json['when'];
    dropArray = List.castFrom<dynamic, BallDropInfo>(json['droparray']);
  }

  Map<String, dynamic> toJson() {
    final data = <String, dynamic>{};
    data['when'] = when;
    data['droparray'] = dropArray.map((v) => v.toJson()).toList();
    return data;
  }
}

class BallDropInfo {
  BallDropInfo({
    required this.num,
    required this.chance,
  });

  late final int num;
  late final double chance;

  BallDropInfo.fromJson(Map<String, dynamic> json) {
    num = json['num'];
    chance = json['chance'];
  }

  Map<String, dynamic> toJson() {
    final data = <String, dynamic>{};
    data['num'] = num;
    data['chance'] = chance;
    return data;
  }
}

class Endure {
  Endure({
    required this.skill,
    required this.endure,
  });

  late final String skill;
  late final double endure;

  Endure.fromJson(Map<String, dynamic> json) {
    skill = json['skill'];
    endure = json['endure'];
  }

  Map<String, dynamic> toJson() {
    final data = <String, dynamic>{};
    data['skill'] = skill;
    data['endure'] = endure;
    return data;
  }
}

class WindZone {
  WindZone({
    required this.skill,
    required this.zone,
    required this.duration,
    required this.radius,
    required this.inner,
    required this.strength,
    required this.attenuation,
    required this.reverse,
  });

  late final String skill;
  late final double zone;
  late final int duration;
  late final double radius;
  late final double inner;
  late final double strength;
  late final double attenuation;
  late final bool reverse;

  WindZone.fromJson(Map<String, dynamic> json) {
    skill = json['skill'];
    zone = json['zone'];
    duration = json['duration'];
    radius = json['radius'];
    inner = json['inner'];
    strength = json['strength'];
    attenuation = json['attenuation'];
    reverse = json['reverse'];
  }

  Map<String, dynamic> toJson() {
    final data = <String, dynamic>{};
    data['skill'] = skill;
    data['zone'] = zone;
    data['duration'] = duration;
    data['radius'] = radius;
    data['inner'] = inner;
    data['strength'] = strength;
    data['attenuation'] = attenuation;
    data['reverse'] = reverse;
    return data;
  }
}

class SkillInfo {
  SkillInfo({
    required this.id,
    required this.ver,
    required this.attackConfigs,
    required this.ballDrops,
    required this.endures,
    required this.windZones,
  });

  late final String id;
  late final Map<String, SkillVer> ver;
  late final List<AttackConfig> attackConfigs;
  late final List<BallDrop> ballDrops;
  late final List<Endure> endures;
  late final List<WindZone> windZones;

  SkillInfo.fromJson(Map<String, dynamic> json) {
    id = json['id'];
    ver = {};
    Map<String, dynamic> temp = json['ver'];
    temp.forEach((key, value) {
      ver[key] = SkillVer.fromJson(value);
    });
    attackConfigs = List.castFrom<dynamic, AttackConfig>(json['attackconfigs']);
    ballDrops = List.castFrom<dynamic, BallDrop>(json['balldrops']);
    endures = List.castFrom<dynamic, Endure>(json['endures']);
    windZones = List.castFrom<dynamic, WindZone>(json['windzones']);
  }

  Map<String, dynamic> toJson() {
    final data = <String, dynamic>{};
    data['id'] = id;
    data['ver'] = ver.map((k, v) => MapEntry(k, v.toJson()));
    data['attackconfigs'] = attackConfigs.map((v) => v.toJson()).toList();
    data['balldrops'] = ballDrops.map((v) => v.toJson()).toList();
    data['endures'] = endures.map((v) => v.toJson()).toList();
    data['windzones'] = windZones.map((v) => v.toJson()).toList();
    return data;
  }
}

class WeaponAscension {
  late final int id;
  late final String location;
  late final int period;

  WeaponAscension.fromJson(Map<String, dynamic> json) {
    id = json['_id'];
    location = json['location'];
    period = json['period'];
  }

  Map<String, dynamic> toJson() {
    final data = <String, dynamic>{};
    data['_id'] = id;
    data['location'] = location;
    data['period'] = period;
    return data;
  }
}

class BannerInfo {
  BannerInfo({
    required this.V,
    required this.P,
  });
  late final String V;
  late final List<BannerP> P;
  
  BannerInfo.fromJson(Map<String, dynamic> json){
    V = json['V'];
    P = List.from(json['P']).map((e)=>BannerP.fromJson(e)).toList();
  }

  Map<String, dynamic> toJson() {
    final _data = <String, dynamic>{};
    _data['V'] = V;
    _data['P'] = P.map((e)=>e.toJson()).toList();
    return _data;
  }
}

class BannerP {
  BannerP({
    required this.id,
    required this.A,
    required this.B,
  });
  late final int id;
  late final List<BannerAB> A;
  late final List<BannerAB> B;
  
  BannerP.fromJson(Map<String, dynamic> json){
    id = json['_id'];
    A = List.from(json['A']).map((e)=>BannerAB.fromJson(e)).toList();
    B = List.from(json['B']).map((e)=>BannerAB.fromJson(e)).toList();
  }

  Map<String, dynamic> toJson() {
    final _data = <String, dynamic>{};
    _data['_id'] = id;
    _data['A'] = A.map((e)=>e.toJson()).toList();
    _data['B'] = B.map((e)=>e.toJson()).toList();
    return _data;
  }
}

class BannerAB {
  BannerAB({
    required this.N,
    required this.X,
  });
  late final String N;
  late final int X;
  
  BannerAB.fromJson(Map<String, dynamic> json){
    N = json['N'];
    X = json['X'];
  }

  Map<String, dynamic> toJson() {
    final _data = <String, dynamic>{};
    _data['N'] = N;
    _data['X'] = X;
    return _data;
  }
}
